package com.lznAdmin.system.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.lznAdmin.base.common.aspect.annotation.Dict;
import lombok.Data;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 * @program: lzn-manage-parent
 * @description:
 * @author: lzn
 * @create: 2021-09-02 12:21
 **/
@Data
@TableName(value = "sys_permission")
public class SysPermission implements Serializable {

    @TableId(type = IdType.AUTO)
    private Long id;

    /**
     * 父资源id,给它初始值 0
     * 新增和修改页面上默认的父资源id
     */
    private Long parentId = 0L;

    /**
     * 用于新增和修改页面上默认的根菜单名称
     */
    @TableField(exist = false)
    private String parentName = "根菜单";

    private String name;
    private String code;
    private String path;
    private String redirect;

    private String component;
    @TableField("`show`")
    private Integer show;

    /**
     * 是否外部打开页面
     */
    private Integer isOutsideShow;

    private Integer orderNum;

    /**
     * 菜单：1，按钮：2
     */
    @Dict(dicCode = "menu_type")
    private Integer type;
    private String icon;
    private String remark;
    private Date createDate;
    private Date updateDate;

    /**
     * 所有子权限对象集合
     * 左侧菜单渲染时要用
     */
    @TableField(exist = false)
    private List<SysPermission> children;

    /**
     * 所有子权限 URL 集合
     * 左侧菜单渲染时要用
     */
    @TableField(exist = false)
    private List<String> childrenUrl;
}
